<?php
/* @var $this ShoeController */
/* @var $dataProvider CActiveDataProvider */

$this->breadcrumbs=array(
	'Shoes',
);

$this->menu=array(
	array('label'=>'Create Shoe', 'url'=>array('create')),
	array('label'=>'Manage Shoe', 'url'=>array('admin')),
);

$list = CHtml::listData(Categories::model()->findAllBySql("select * from  v_categories where published != ':value01'  ", array(':value01' => '1')),
		 'id', 
		'name',
		'parent');


$items = array();
$childitems = array();
foreach ($list as $key1=>$value1)
{
	//父分类
	if ($key1 == 1)
	{
		//父分类下的子分类
		foreach ($value1 as $key2=>$value2){
			
			//构成父分类下的子分类菜单
			foreach ($list[$key2] as $key3=>$value3)
			{
				array_push($childitems, array('label'=>$value3, 'url'=>array('/vip/categories/style/'.$key3)));
			}
			
			array_push($childitems,array('label'=>''));

			//构成父分类与父分类下的子分类菜单					
			array_push($items,array('label'=>$value2, 'url'=>array('/vip/categories/style/'.$key2), 'items'=>$childitems));
			
			//为重构第二个子菜单，准备
			$childitems = array();
				
		}
	}	
}

//var_dump($items);



?>




<div class="goods-catalog-container">

<aside class="goods-sidebar">
<h3 class="widgettitle">Catalog</h3>
	<div class="span"></div>
	<?php 
	$this->widget('zii.widgets.CMenu', array(
		'activeCssClass'=>'current',
		//'firstItemCssClass'=>'第一个元素的样式',
		//'lastItemCssClass'=>'最后一个元素的样式',
		//'encodeLable'=>'false'  //這樣，label標籤中就會輸出html.
		'htmlOptions'=>array('class'=>'clst'),
		'items'=>$items
	));
	?>

</aside>

<div class="goods-catalog">
<div class="catalog-inner">
		<div class="breadcrumb">
		<a class="home" href="<?php echo Yii::app()->baseUrl; ?>">Home</a> &gt;&gt; 
		<a href="<?php echo $this->createUrl('/vip/shoe'); ?>">Catalog</a>
		</div>
		
		
	<?php $this->widget('zii.widgets.CListView', array(
		'dataProvider'=>$dataProvider,
		'itemView'=>'_idxview',
		'template'=>'{items}{pager}',
	)); ?>
		
		
		</div>
</div>


</div>
